<style scoped lang="scss">
	.container {
		padding-top: R(20);
	}

	.terminal-info-content {
		margin: 0 R(20px);
		border-radius: R(20);
		background: #fff url(@/common/images/newIcon/com-bg2.png) no-repeat;
		background-size: 100% auto;
	}

	.button-box {
		display: flex;
		justify-content: space-around;
		align-items: center;
		margin-top: R(50);

		.button {
			border-radius: R(50);
			padding: 0 R(30);
			background-color: $themeColor;
			text-align: center;
			height: R(80);
			line-height: R(80);
			color: #ffffff;
		}

		.pre-btn {
			width: 40%;
			background-color: #e60909;
		}

		.next-btn {
			width: 40%;
		}
	}
</style>
<template>
	<div class="container">
		<div class="terminal-info-content" v-if="customData.agentName">
			<u-cell-item :arrow="false" hover-class="none" title="商户编号：" :value="customData.merchNo"><i
					slot="right-icon" class="iconfont icon-niantie" @click="copy(customData.merchNo)"></i></u-cell-item>
			<u-cell-item :arrow="false" hover-class="none" title="商户名称：" :value="customData.merchName" />
			<u-cell-item :arrow="false" hover-class="none" title="终端号：" :value="customData.serialno"><i
					slot="right-icon" class="iconfont icon-niantie"
					@click="copy(customData.serialno)"></i></u-cell-item>

			<u-cell-item :arrow="false" hover-class="none" title="订单号：" :value="customData.orderNo"><i slot="right-icon"
					class="iconfont icon-niantie" @click="copy(customData.orderNo)"></i></u-cell-item>
			<!-- <u-cell-item :arrow="false" hover-class="none" title="代理商编号：" :value="customData.agentno"></u-cell-item> -->
			<!-- <u-cell-item :arrow="false" hover-class="none" title="代理商名称：" :value="customData.agentName" /> -->

			<u-cell-item :arrow="false" hover-class="none" title="交易类型：" :value="customData.totalTypeName" />
			<u-cell-item :arrow="false" hover-class="none" title="政策：" :value="customData.policyName" />
			<u-cell-item :arrow="false" hover-class="none" title="政策代码：" :value="customData.policyCode" />
			<u-cell-item :arrow="false" hover-class="none" title="总分润金额：" :value="customData.leftAllAmount" />
			<u-cell-item :arrow="false" hover-class="none" title="分润金额：" :value="customData.shareAmount" />
			<u-cell-item :arrow="false" hover-class="none" title="分润截留占比：" :value="customData.percent+'%'" />
			<u-cell-item :arrow="false" hover-class="none" title="添加日期：" :value="customData.createTime"
				class="agent-info-list-cell" />
		</div>

	</div>
</template>

<script>
	import {
		delInfo
	} from '_a/price-property';

	export default {
		name: "Info",
		data() {
			return {
				customData: {},
			};
		},
		created() {
			this.customData = this.$storage.getStore("propertyDetailInfo") || {};
			// console.log(this.customData);
		},
		filters: {
			percent(v) {
				return (v * 100) + '%'
			}
		},
		methods: {
			editQuest() {
				this.$nav.push({
					path: '/pages/home/price-property/add?type=edit'
				});
			},
			deleteQuest() {
				this.$tip.modal({
					title: '提示',
					content: `是否确认删${this.customData.policyName}?`
				}).then(async res => {
					let data = await delInfo(this.customData.id);
					if (data.code == 200) {
						this.$tip
							.modal({
								content: '删除成功!',
								showCancel: false
							}).then(res => {
								this.$nav.goBack();
								uni.$emit('update')
							})
					} else {
						this.$tip.modal('提示', data.msg)
					}
				});

			},
			copy(value) {
				uni.setClipboardData({
					data: value,
					success: () => {
						this.$tip.toast("复制成功!");
					},
				});
			},
			initInfo() {
				getById(this.customData.id).then((res) => {
					if (res.code === 200) {
						this.customData = res.data;
					}
				});
			},
		},
	};
</script>